package com.company.笔试.像素;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @Classname Solution
 * @Description TODO
 * @Date 2021/9/7 19:52
 * @Created by ylr
 * n k
 */
public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[][] res = new int[n + 1][k + 1];
        int len = 0;
        for (int i = 1; i < n; i++) {

            String s = sc.nextLine();
            String[] s1 = s.split(" ");
            len = s.length();
            int col = 0;
            int row = i * k;
            for (int j = 1; j < len; j++) { //3个数字
                int num = Integer.parseInt(String.valueOf(s1[j - 1])); //数字
                for (; col < j * k; col++) {  //列更新
                    for (int m = row - k; m < row; m++) { //行更新
                        res[m][col] = num;
                    }

                }
            }

        }

        for (int[] re : res) {
            for (int i : re) {
                System.out.print(i);
            }
            System.out.println();
        }

    }
}
